package org.rsbot.script.util;

import java.awt.Point;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

public class WindowUtil
{
  public static final int YES_OPTION = 0;
  public static final int NO_OPTION = 1;
  public static final int CANCEL_OPTION = 2;
  public static final int OK_OPTION = 0;
  public static final int DIALOG_CLOSED = -1;
  public static final int YES_NO_CANCEL = 1;
  public static final int YES_NO = 0;
  public static final int OK_CANCEL = 2;
  private static JFrame frame = null;

  public static void setFrame(JFrame paramJFrame)
  {
    if (frame == null)
      frame = paramJFrame;
  }

  public static void showDialog(String paramString)
  {
    JOptionPane.showMessageDialog(frame, paramString);
  }

  public static String showInputDialog(String paramString)
  {
    return JOptionPane.showInputDialog(frame, paramString);
  }

  public static int showConfirmDialog(String paramString)
  {
    return JOptionPane.showConfirmDialog(frame, paramString);
  }

  public static int showConfirmDialog(String paramString, int paramInt)
  {
    return JOptionPane.showConfirmDialog(frame, paramString, "Confirm", paramInt);
  }

  public static void position(JFrame paramJFrame)
  {
    paramJFrame.setLocationRelativeTo(frame);
  }

  public static Point getWindowLocation()
  {
    return frame.getLocationOnScreen();
  }

  public static void minimizeWindow()
  {
    frame.setState(1);
  }

  public static void restoreWindow()
  {
    frame.setState(0);
  }

  public static void unmaximizeWindow()
  {
    frame.setExtendedState(0);
  }

  public static void maximizeWindow()
  {
    frame.setExtendedState(frame.getExtendedState() | 0x6);
  }
}